const express = require('express')
const c = require('../connection')
const router = express.Router()

//  修改密码接口

router.post('/',(req,res)=>{
    var obj=req.body
    console.log(obj);
    c.query('update cs_login set? where username=?',[obj,obj.username],(err,r)=>{
        if(err){
           throw err
        }
        console.log(r);
        console.log(r.changedRows);
        if(r.changedRows===0){
            res.send({
                code:401,
                msg:'修改失败'
            })
        }else{
            res.send({
                code:200,
                msg:'修改成功'
            })
        }
    })
})
module.exports = router